package com.sdx.console.live.entity;

import java.util.Date;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;

import com.fasterxml.jackson.annotation.JsonIgnore;
import org.beetl.sql.core.annotatoin.ColumnIgnore;
import org.beetl.sql.core.annotatoin.AutoID;
import org.beetl.sql.core.annotatoin.SeqID;
import org.apache.commons.lang3.StringUtils;
import com.ibeetl.admin.core.util.ValidateConfig;
import com.sdx.service.ConfigService;

import org.beetl.sql.core.TailBean;
import java.math.*;

import com.ibeetl.admin.core.annotation.Dict;
import com.ibeetl.admin.core.entity.BaseEntity;

import org.beetl.sql.core.annotatoin.InsertIgnore;
import org.beetl.sql.core.annotatoin.Version;
import org.beetl.sql.core.annotatoin.LogicDelete;
import com.sdx.common.utils.Utils;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Data;

/* 
* 
* gen by Spring Boot2 Admin 2019-05-09
*/
@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
@Data
public class CourseLive extends BaseEntity{

    //直播课程id
    @NotNull(message = "ID不能为空", groups =ValidateConfig.UPDATE.class)
    @AutoID	
    private Integer liveId ;
	
    //直播主题
    private String liveTitle ;
	
    //副标题
    private String liveSubTitle ;
	
    //课程老师id
    private String teacherId ;
	
    //老师名字
    private String tearchName ;
	
    //直播内容
    private String brief ;
	
    //封面
    private String cover ;
	
    //课件地址
    private String coursewareUrl ;
	
    //归属省份 0、表示全国
    private Integer provinceId ;
	
    //直播价格 单位分
    private Integer coursePrice ;
	
    //优惠名额 指从第几名开始收费
    private Integer freeNum ;
	
    //直播开始时间
    private String startTime ;
	
    //直播结束时间
    private String endTime ;
	
    //拉流地址
    private String pullUrl ;
	
    //直播状态 1、预约，2、直播中，3、回看
    private String liveStatus ;
	
    //在线状态 1、上线，0、下线
    private String courseStatus ;
	
    //创建人
    private Integer createdBy ;
	
    //创建人名称
    private String createdName ;
	
    //创建时间
    private Date createdTime ;
	
    //更新人
    private Integer updatedBy ;
	
    //更新人名称
    private String updatedName ;
	
    //更新时间
    private Date updatedTime ;

    // 直播类型
    // 1、志愿填报
    // 2、专业解读
    // 3、院校盘点
    // 4、自主招生
    // 5、港澳申请
    // 6、经验技巧
    @Dict(type = "LIVE_TYPE")
    private Integer liveType;

    //讲座ID
    private Integer lectureId;

    //所属平台 1、圣达信，2、高三网，3、七天网络
    private Integer platform;

    public String getCoverView(){
        return Utils.imageUrl(cover);
    }

    public String getCoursewareUrlLink(){
        return Utils.imageUrl(coursewareUrl);
    }
	
	@ColumnIgnore
	@JsonIgnore
	private String startTimeQuery;
	@ColumnIgnore
	@JsonIgnore
	private Date startTimeStart;
	@ColumnIgnore
	@JsonIgnore
	private Date startTimeEnd;
	public String getStartTimeQuery(){
		return  startTimeQuery;
	}
	public void setStartTimeQuery(String startTimeQuery ){
		this.startTimeQuery = startTimeQuery;
		Date[] timePair = Utils.parseQueryTime(startTimeQuery);
		if (timePair!=null && timePair[0]!=null) {
			this.startTimeStart = timePair[0];
		}
		if (timePair!=null && timePair.length==2 && timePair[1]!=null) {
			this.startTimeEnd = timePair[1];
		}

	}
	public Date getStartTimeStart(){
		return  startTimeStart;
	}
	public void setStartTimeStart(Date startTimeStart ){
		this.startTimeStart = startTimeStart;
	}
	public Date getStartTimeEnd(){
		return  startTimeEnd;
	}
	public void setStartTimeEnd(Date startTimeEnd ){
		this.startTimeEnd = startTimeEnd;
	}

}
